import request from '@/utils/request'

export function getRoutes() {
  return request({
    url: '/routes',
    method: 'get'
  })
}

export function getRoles() {
  return request({
    url: '/roles',
    method: 'get'
  })
}

export function addRole(data) {
  return request({
    url: '/role/save',
    method: 'post',
    data
  })
}

export function getList(data) {
  return request({
    url: '/role/getList',
    method: 'post',
    data
  })
}

export function editRole(data) {
  return request({
    url: `/role/edit`,
    method: 'post',
    data
  })
}

export function deleteRole(id) {
  return request({
    url: `/role/${id}`,
    method: 'delete'
  })
}

export function getRoleAllList(data) {
  return request({
    url: `/role/getAllList`,
    method: 'get',
    params: data
  })
}

export function saveMenu(data) {
  return request({
    url: '/role/saveMenu',
    method: 'post',
    data
  })
}

export function getRoleMenuList(data) {
  return request({
    url: '/role/getRoleMenuList',
    method: 'get',
    params: data
  })
}

export function getRoleAuthorit(data) {
  return request({
    url: '/role/getRoleAuthorit',
    method: 'get',
    params: data
  })
}

export function saveAuthorit(data) {
  return request({
    url: '/role/saveAuthorit',
    method: 'post',
    data
  })
}

export function getAllListByDdepartid(data) {
  return request({
    url: '/role/getAllListByDdepartid',
    method: 'get',
    params: data
  })
}

export function getWDAuthTreeList(data) {
  return request({
    url: '/fileAuthority/getAuthTreeList',
    method: 'post',
    params: data
  })
}

export function saveWDAuthorit(data) {
  return request({
    url: '/fileAuthority/saveAuthorit',
    method: 'post',
    data
  })
}

export function getNewRoleAllList(departid) {
  return request({
    url: `/role/getNewAllList`,
    method: 'get',
    params: { departid }
  })
}

export function getRoleProject(data) {
  return request({
    url: '/role/getRoleProject',
    method: 'post',
    params: data
  })
}

export function saveProject(data) {
  return request({
    url: '/role/saveProject',
    method: 'post',
    data
  })
}
